yxc = {'鲁班': 100, '甄姬': 120, '妲己': 130}
print(yxc['鲁班'])
# print(yxc['王昭君'])

# 防止报错
# 如果不存在，返回None
print(yxc.get('甄姬'))
print(yxc.get('安其拉'))
# 防止返回None，可以指定要给默认值
print(yxc.get('赵云', 180))

# 新增
yxc['后羿'] = 145
print(yxc)

# 修改
yxc['后羿'] = 160
print(yxc)

# 遍历
for item in yxc.items():
    print(item)
print('+++++++++++')
for k, v in yxc.items():
    print(k + ' >>> ' + str(v))
print('+++++++++++')
for key in yxc.keys():
    print(key)
print('+++++++++++')
for value in yxc.values():
    print(str(value))

